package com.map.station;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {

	private Button showButt, searchButt, optionButt, updateButt;
	private Intent intent;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
			
		showButt = (Button)findViewById(R.id.show_button);
		searchButt = (Button)findViewById(R.id.search_button);
		optionButt = (Button)findViewById(R.id.option_button);
		updateButt = (Button)findViewById(R.id.oil_button);
		
		showButt.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				gotoMap();
			}
		});
		
		searchButt.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				gotoSearch();
			}
		});
		
		optionButt.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				gotoOption();
			}
		});
		
		updateButt.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				gotoUpdatePrice();
			}
		});
	}
	// End of onCreate()
	
	private void gotoMap() {
		Intent intent = new Intent(this, MapsActivity.class);
		startActivity(intent);
	}
	
	private void gotoSearch() {
		Intent intent = new Intent(this, SearchActivity.class);
		startActivity(intent);
	}
	
	private void gotoOption() {
		Intent intent = new Intent(this, OptionPreference.class);
		startActivity(intent);
	}
	
	private void gotoUpdatePrice() {
    	intent = new Intent(android.content.Intent.ACTION_VIEW,
    			Uri.parse("http://www.eppo.go.th/retail_prices.html"));
    	startActivity(intent);
    }
}